package model;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: a
 * Date: 2022-12-06
 * Time: 22:36
 */
public class UserNameToId {
    private int M = 10000007;
    private int B = 233;

    public int getId(String username){
        int res = 0;
        for (int i = 0; i < username.length(); ++i) {
            res = (int)((long)(res * B + username.charAt(i)) % M);
        }
        return res;
    }
}
